#include <GL/gl.h>
#include <GL/glu.h>
#include <SDL/SDL.h>
#include "Game.h"
#define window_width 640
#define window_height 480
#include <iostream>

int main()
{
	std::cout << "hello world :)";
	//Init SDL with best video mode
	SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
	const SDL_VideoInfo* info = SDL_GetVideoInfo();
	int vidFlags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER;
	if (info->hw_available)
	{
		vidFlags |= SDL_HWSURFACE;
	}
	else
	{
		vidFlags |= SDL_SWSURFACE;
	}
	int bpp = info->vfmt->BitsPerPixel;
	SDL_SetVideoMode(window_width, window_height, bpp, vidFlags);
	//gl setup
	glEnable(GL_TEXTURE_2D);
	glViewport(0, 0, window_width, window_height);
	
	glMatrixMode(GL_PROJECTION);
//	glMatrixMode(GL_MODELVIEW);
	glEnable(GL_DEPTH_TEST);
	gluPerspective(45, (float)window_width / window_height, 0.1, 100);
	glMatrixMode(GL_MODELVIEW);
	
	Game game;
	std::cout << "running!";
	game.run();
	return 0;
}
